package familySetting

import (
	"github.com/gofiber/fiber/v2"
	"sg-backend/global"
	"sg-backend/model/paylog"
)

func GetFamilyType(ctx *fiber.Ctx) error {

	// 获取家庭成员json
	var familyTypeList []paylog.FamilyType
	if err := global.DB.Where("user_id = ?", global.AuthUser.UserId).Find(&familyTypeList); err.Error != nil {
		return ctx.JSON(fiber.Map{
			"status":  "error",
			"message": "获取家庭成员List失败！！",
		})
	}

	// 返回
	return ctx.JSON(fiber.Map{
		"status":  "done",
		"message": "请求成功！",
		"data":    familyTypeList,
	})
}
